from django.db import models

    
class Enlace (models.Model):
    #url = models.URLField(max_length = 1024, verify_exists = False ,primary_key = True)
    url = models.CharField(max_length = 1024 )
    nombre = models.CharField(max_length = 128 )
    
    def __unicode__(self):
        return unicode (self.nombre) + ": " + unicode (self.url)
    
class Seccion (Enlace):
    descripcion = models.TextField (blank = True)
    #TODO se podria meter un conjunto de elmentos de navegacion secundarios por seccion
    
class Config (models.Model):
    base = models.URLField ( max_length = 256, verify_exists=False )
    home =  models.ForeignKey ( 'Enlace', related_name = 'Home' )
    intro = models.ForeignKey ( 'Seccion', related_name = 'Intro' , blank = True )
    secciones = models.ManyToManyField (Seccion, related_name='Secciones', blank = True )
    footer = models.TextField ()
    
    def __unicode__(self):
        return unicode (self.home)
    
    
    